package com.xiaoming.backend.dao.impl;

import com.xiaoming.backend.dao.IWasteDao;
import com.xiaoming.backend.dao.mapper.WastePOMapper;
import com.xiaoming.backend.entity.db.po.WastePO;
import com.xiaoming.backend.result.exception.AppErrorException;
import com.xiaoming.backend.result.exception.error.AppError;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class WasteDao implements IWasteDao {
    private final  WastePOMapper wastePOMapper;

    @Override
    public int insertWaste(WastePO wastePO) {
        if (wastePO == null){
            throw new AppErrorException(AppError.WASTE_INERT_ERROR);
        }
        return wastePOMapper.insertWastePO(wastePO);
    }
}
